home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / GXEnvironment.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  9.2 KB  |  267 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        GXEnvironment.h
  3.  
  4.      Contains:    QuickDraw GX environment constants and interfaces
  5.  
  6.      Version:    Technology:    Quickdraw GX 1.1
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1994-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __GXENVIRONMENT__
  18. #define __GXENVIRONMENT__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21. #include <ConditionalMacros.h>
  22. #endif
  23. #ifndef __MIXEDMODE__
  24. #include <MixedMode.h>
  25. #endif
  26. #ifndef __QUICKDRAW__
  27. #include <Quickdraw.h>
  28. #endif
  29. #ifndef __GXTYPES__
  30. #include <GXTypes.h>
  31. #endif
  32. #ifndef __CMAPPLICATION__
  33. #include <CMApplication.h>
  34. #endif
  35.  
  36.  
  37.  
  38. #if PRAGMA_ONCE
  39. #pragma once
  40. #endif
  41.  
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45.  
  46. #if PRAGMA_IMPORT
  47. #pragma import on
  48. #endif
  49.  
  50. #if PRAGMA_STRUCT_ALIGN
  51.     #pragma options align=mac68k
  52. #elif PRAGMA_STRUCT_PACKPUSH
  53.     #pragma pack(push, 2)
  54. #elif PRAGMA_STRUCT_PACK
  55.     #pragma pack(2)
  56. #endif
  57.  
  58. #if defined(__MWERKS__) && TARGET_CPU_68K
  59.     #pragma push
  60.     #pragma pointers_in_D0
  61. #endif
  62.  
  63. /* old header = graphics macintosh */
  64.  
  65.  
  66. enum {
  67.     defaultPollingHandlerFlags    = 0x00,
  68.     okToSwitchDuringPollFlag    = 0x00,
  69.     dontSwitchDuringPollFlag    = 0x01
  70. };
  71.  
  72. typedef long                             gxPollingHandlerFlags;
  73. typedef CALLBACK_API_C( void , gxPollingHandlerProcPtr )(long reference, gxPollingHandlerFlags flags);
  74. typedef STACK_UPP_TYPE(gxPollingHandlerProcPtr)                 gxPollingHandlerUPP;
  75. enum { uppgxPollingHandlerProcInfo = 0x000003C1 };                 /* no_return_value Func(4_bytes, 4_bytes) */
  76. #define NewgxPollingHandlerProc(userRoutine)                     (gxPollingHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxPollingHandlerProcInfo, GetCurrentArchitecture())
  77. #define CallgxPollingHandlerProc(userRoutine, reference, flags)  CALL_TWO_PARAMETER_UPP((userRoutine), uppgxPollingHandlerProcInfo, (reference), (flags))
  78. EXTERN_API_C( gxPollingHandlerUPP )
  79. GXGetGraphicsPollingHandler        (long *                    reference)                            THREEWORDINLINE(0x303C, 0x0245, 0xA832);
  80.  
  81. EXTERN_API_C( void )
  82. GXSetGraphicsPollingHandler        (gxPollingHandlerUPP     handler,
  83.                                  long                     reference)                            THREEWORDINLINE(0x303C, 0x0246, 0xA832);
  84.  
  85. /* old header = graphics toolbox */
  86.  
  87.  
  88. /* QD to QD GX Translator typedefs */
  89.  
  90. enum {
  91.     gxDefaultOptionsTranslation    = 0x0000,
  92.     gxOptimizedTranslation        = 0x0001,
  93.     gxReplaceLineWidthTranslation = 0x0002,
  94.     gxSimpleScalingTranslation    = 0x0004,
  95.     gxSimpleGeometryTranslation    = 0x0008,                        /* implies simple scaling */
  96.     gxSimpleLinesTranslation    = 0x000C,                        /* implies simple geometry & scaling */
  97.     gxLayoutTextTranslation        = 0x0010,                        /* turn on gxLine layout (normally off) */
  98.     gxRasterTargetTranslation    = 0x0020,
  99.     gxPostScriptTargetTranslation = 0x0040,
  100.     gxVectorTargetTranslation    = 0x0080,
  101.     gxPDDTargetTranslation        = 0x0100,
  102.     gxDontConvertPatternsTranslation = 0x1000,
  103.     gxDontSplitBitmapsTranslation = 0x2000
  104. };
  105.  
  106. typedef long                             gxTranslationOption;
  107.  
  108. enum {
  109.     gxContainsFormsBegin        = 0x0001,
  110.     gxContainsFormsEnd            = 0x0002,
  111.     gxContainsPostScript        = 0x0004,
  112.     gxContainsEmptyPostScript    = 0x0008
  113. };
  114.  
  115. typedef long                             gxTranslationStatistic;
  116.  
  117. enum {
  118.     gxQuickDrawPictTag            = FOUR_CHAR_CODE('pict')
  119. };
  120.  
  121.  
  122. struct gxQuickDrawPict {
  123.                                                                 /* translator inputs */
  124.     gxTranslationOption             options;
  125.     Rect                             srcRect;
  126.     Point                             styleStretch;
  127.  
  128.                                                                 /* size of quickdraw picture data */
  129.     unsigned long                     dataLength;
  130.  
  131.                                                                 /* file alias */
  132.     gxBitmapDataSourceAlias         alias;
  133. };
  134. typedef struct gxQuickDrawPict            gxQuickDrawPict;
  135. /* WindowRecord utilities */
  136. EXTERN_API_C( gxViewPort )
  137. GXNewWindowViewPort                (WindowPtr                 qdWindow)                            THREEWORDINLINE(0x303C, 0x0236, 0xA832);
  138.  
  139. EXTERN_API_C( gxViewPort )
  140. GXGetWindowViewPort                (WindowPtr                 qdWindow)                            THREEWORDINLINE(0x303C, 0x0237, 0xA832);
  141.  
  142. EXTERN_API_C( WindowPtr )
  143. GXGetViewPortWindow                (gxViewPort             portOrder)                            THREEWORDINLINE(0x303C, 0x0238, 0xA832);
  144.  
  145. /* GDevice utilities */
  146. EXTERN_API_C( GDHandle )
  147. GXGetViewDeviceGDevice            (gxViewDevice             theDevice)                            THREEWORDINLINE(0x303C, 0x0239, 0xA832);
  148.  
  149. EXTERN_API_C( gxViewDevice )
  150. GXGetGDeviceViewDevice            (GDHandle                 qdGDevice)                            THREEWORDINLINE(0x303C, 0x023A, 0xA832);
  151.  
  152. /* gxPoint utilities */
  153. EXTERN_API_C( void )
  154. GXConvertQDPoint                (const Point *            shortPt,
  155.                                  gxViewPort             portOrder,
  156.                                  gxPoint *                fixedPt)                            THREEWORDINLINE(0x303C, 0x023B, 0xA832);
  157.  
  158. typedef CALLBACK_API_C( OSErr , gxShapeSpoolProcPtr )(gxShape toSpool, long refCon);
  159. /* printing utilities typedef */
  160. typedef CALLBACK_API_C( void , gxUserViewPortFilterProcPtr )(gxShape toFilter, gxViewPort portOrder, long refCon);
  161. typedef CALLBACK_API_C( long , gxConvertQDFontProcPtr )(gxStyle dst, long txFont, long txFace);
  162. typedef STACK_UPP_TYPE(gxShapeSpoolProcPtr)                     gxShapeSpoolUPP;
  163. typedef STACK_UPP_TYPE(gxUserViewPortFilterProcPtr)             gxUserViewPortFilterUPP;
  164. typedef STACK_UPP_TYPE(gxConvertQDFontProcPtr)                     gxConvertQDFontUPP;
  165. enum { uppgxShapeSpoolProcInfo = 0x000003E1 };                     /* 2_bytes Func(4_bytes, 4_bytes) */
  166. enum { uppgxUserViewPortFilterProcInfo = 0x00000FC1 };             /* no_return_value Func(4_bytes, 4_bytes, 4_bytes) */
  167. enum { uppgxConvertQDFontProcInfo = 0x00000FF1 };                 /* 4_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  168. #define NewgxShapeSpoolProc(userRoutine)                         (gxShapeSpoolUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxShapeSpoolProcInfo, GetCurrentArchitecture())
  169. #define NewgxUserViewPortFilterProc(userRoutine)                 (gxUserViewPortFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxUserViewPortFilterProcInfo, GetCurrentArchitecture())
  170. #define NewgxConvertQDFontProc(userRoutine)                     (gxConvertQDFontUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxConvertQDFontProcInfo, GetCurrentArchitecture())
  171. #define CallgxShapeSpoolProc(userRoutine, toSpool, refCon)         CALL_TWO_PARAMETER_UPP((userRoutine), uppgxShapeSpoolProcInfo, (toSpool), (refCon))
  172. #define CallgxUserViewPortFilterProc(userRoutine, toFilter, portOrder, refCon)  CALL_THREE_PARAMETER_UPP((userRoutine), uppgxUserViewPortFilterProcInfo, (toFilter), (portOrder), (refCon))
  173. #define CallgxConvertQDFontProc(userRoutine, dst, txFont, txFace)  CALL_THREE_PARAMETER_UPP((userRoutine), uppgxConvertQDFontProcInfo, (dst), (txFont), (txFace))
  174.  
  175. typedef gxShapeSpoolProcPtr             gxShapeSpoolFunction;
  176. typedef gxUserViewPortFilterProcPtr     gxUserViewPortFilter;
  177. typedef gxConvertQDFontProcPtr             gxConvertQDFontFunction;
  178. /* mouse utilities */
  179. /* return mouse location in fixed-gxPoint global space */
  180. EXTERN_API_C( void )
  181. GXGetGlobalMouse                (gxPoint *                globalPt)                            THREEWORDINLINE(0x303C, 0x023C, 0xA832);
  182.  
  183. /* return fixed-gxPoint local mouse (gxViewPort == 0 --> default) */
  184. EXTERN_API_C( void )
  185. GXGetViewPortMouse                (gxViewPort             portOrder,
  186.                                  gxPoint *                localPt)                            THREEWORDINLINE(0x303C, 0x023D, 0xA832);
  187.  
  188. /* printing utilities */
  189. EXTERN_API_C( gxUserViewPortFilterUPP )
  190. GXGetViewPortFilter                (gxViewPort             portOrder,
  191.                                  long *                    refCon)                                THREEWORDINLINE(0x303C, 0x025E, 0xA832);
  192.  
  193. EXTERN_API_C( void )
  194. GXSetViewPortFilter                (gxViewPort             portOrder,
  195.                                  gxUserViewPortFilterUPP  filter,
  196.                                  long                     refCon)                                THREEWORDINLINE(0x303C, 0x023E, 0xA832);
  197.  
  198. /* QD to QD GX Translator functions */
  199. EXTERN_API_C( void )
  200. GXInstallQDTranslator            (GrafPtr                 port,
  201.                                  gxTranslationOption     options,
  202.                                  const Rect *            srcRect,
  203.                                  const Rect *            dstRect,
  204.                                  Point                     styleStrech,
  205.                                  gxShapeSpoolUPP         userFunction,
  206.                                  void *                    reference)                            THREEWORDINLINE(0x303C, 0x023F, 0xA832);
  207.  
  208. EXTERN_API_C( gxTranslationStatistic )
  209. GXRemoveQDTranslator            (GrafPtr                 port,
  210.                                  gxTranslationStatistic * statistic)                        THREEWORDINLINE(0x303C, 0x0240, 0xA832);
  211.  
  212. EXTERN_API_C( gxShape )
  213. GXConvertPICTToShape            (PicHandle                 pict,
  214.                                  gxTranslationOption     options,
  215.                                  const Rect *            srcRect,
  216.                                  const Rect *            dstRect,
  217.                                  Point                     styleStretch,
  218.                                  gxShape                 destination,
  219.                                  gxTranslationStatistic * stats)                            THREEWORDINLINE(0x303C, 0x0241, 0xA832);
  220.  
  221. /* Find the best GX style given a QD font and face. Called by the QD->GX translator */
  222. EXTERN_API_C( long )
  223. GXConvertQDFont                    (gxStyle                 theStyle,
  224.                                  long                     txFont,
  225.                                  long                     txFace)                                THREEWORDINLINE(0x303C, 0x0242, 0xA832);
  226.  
  227. EXTERN_API_C( gxConvertQDFontUPP )
  228. GXGetConvertQDFont                (void)                                                        THREEWORDINLINE(0x303C, 0x0243, 0xA832);
  229.  
  230. EXTERN_API_C( void )
  231. GXSetConvertQDFont                (gxConvertQDFontUPP     userFunction)                        THREEWORDINLINE(0x303C, 0x0244, 0xA832);
  232.  
  233. typedef unsigned long                     gxProfilePoolAttributes;
  234.  
  235. struct gxFlatProfileListItem {
  236.     gxProfilePoolAttributes         attributes;                    /* information about this particular profile's source*/
  237.     CMProfileRef                     profileRef;                    /* reference to profile, only valid before shape is disposed*/
  238.     CMProfileIdentifier             identifier;                    /* information on how to find the profile upon unflattening*/
  239. };
  240. typedef struct gxFlatProfileListItem    gxFlatProfileListItem;
  241.  
  242.  
  243. #if defined(__MWERKS__) && TARGET_CPU_68K
  244.     #pragma pop
  245. #endif
  246.  
  247. #if PRAGMA_STRUCT_ALIGN
  248.     #pragma options align=reset
  249. #elif PRAGMA_STRUCT_PACKPUSH
  250.     #pragma pack(pop)
  251. #elif PRAGMA_STRUCT_PACK
  252.     #pragma pack()
  253. #endif
  254.  
  255. #ifdef PRAGMA_IMPORT_OFF
  256. #pragma import off
  257. #elif PRAGMA_IMPORT
  258. #pragma import reset
  259. #endif
  260.  
  261. #ifdef __cplusplus
  262. }
  263. #endif
  264.  
  265. #endif /* __GXENVIRONMENT__ */
  266.  
  267.